package com.xmg.p2p.base.controller;

import com.xmg.p2p.base.service.IVerifyCodeService;
import com.xmg.p2p.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService verifyCodeService;

    @ResponseBody
    @RequestMapping("sendVerifyCode")
    public JSONResult sendVerifyCode(String phoneNumber) {
        JSONResult json = new JSONResult();
        try {
            verifyCodeService.sendVerifyCode(phoneNumber);
        } catch (Exception e) {
            json.setMsg(e.getMessage());
            json.setSuccess(false);
            e.printStackTrace();
        }
        return json;
    }
}
